Google News
logo
ReactJS - Quiz(MCQ)
How do you destructure the properties that are sent to the Dish component?
function Dish(props) {
  return (
    <h1>
      {props.name} {props.cookingTime}
    </h1>
  );
}
A)
function Dish([name, cookingTime]) { return <h1>{name} {cookingTime}</h1>; } 
B)
function Dish({name, cookingTime}) { return <h1>{name} {cookingTime}</h1>; }  
C)
function Dish(props) { return <h1>{name} {cookingTime}</h1>; }   
D)
function Dish(...props) { return <h1>{name} {cookingTime}</h1>; } 

Correct Answer :   function Dish({name, cookingTime}) { return <h1>{name} {cookingTime}</h1>; }